//
//  YCCameraConstants.swift
//  YCCamera
//
//  Created by Billy on 2024/11/6.
//

import UIKit

enum YCCameraConstants {
    
    // MARK: - Layout
    enum Layout {
        static let bottomViewHeight: CGFloat = 200
        static let displayViewAspectRatio: CGFloat = 4.0 / 3.0
        static let previewCornerRadius: CGFloat = 20
        
        // Camera Button
        static let largeCircleRadius: CGFloat = 80
        static let smallCircleRadius: CGFloat = 65
        static let largeCircleRecordScale: CGFloat = 1.2
        static let smallCircleRecordScale: CGFloat = 0.5
        static let borderLayerWidth: CGFloat = 1.8
        static let animateLayerWidth: CGFloat = 5
    }
    
    // MARK: - Colors
    enum Colors {
        static let primaryBackground = UIColor(red: 27/255.0, green: 27/255.0, blue: 27/255.0, alpha: 1.0)
        static let cameraButtonNormal: UIColor = .white
        static let cameraButtonRecordingBorder = UIColor.white.withAlphaComponent(0.8)
        static let selectionGreen = UIColor.systemGreen
    }
    
    // MARK: - Animation
    enum Animation {
        static let shutterOpenDuration: TimeInterval = 0.3
        static let shutterCloseDuration: TimeInterval = 0.25
        static let photoFlashDuration: TimeInterval = 0.1
        static let photoFlashDelay: TimeInterval = 0.05
        static let focusDuration: TimeInterval = 1.0
        static let filterNameDisplayDuration: TimeInterval = 1.0
        static let filterNameFadeDuration: TimeInterval = 0.3
        static let deviceMotionUpdateInterval: TimeInterval = 0.5
        static let uiRotationDuration: TimeInterval = 0.15
    }
    
    // MARK: - Filter Selection
    enum FilterSelection {
        static let containerHeight: CGFloat = 200
        static let collectionViewHeight: CGFloat = 120
        static let collectionViewTopOffset: CGFloat = 20
        static let closeButtonOffset: CGFloat = 16
        static let closeButtonSize: CGFloat = 40
        static let cellSize = CGSize(width: 75, height: 95)
        static let minimumLineSpacing: CGFloat = 12
        static let sectionInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)
    }
    
    // MARK: - Camera
    enum Camera {
        static let maxZoomFactor: CGFloat = 15.0
        static let metalPreferredFPS: Int = 30
        static let filterChangeThreshold: CGFloat = 50
        static let shutterSpeedDebounceInterval: TimeInterval = 0.2
    }
    
    // MARK: - Focus
    enum Focus {
        static let cursorSize: CGFloat = 70
        static let animationScaleStart: CGFloat = 2.0
        static let animationScaleMiddle: CGFloat = 0.85
        static let animationScaleEnd: CGFloat = 1.0
        static let animationPhaseDuration: TimeInterval = 0.2
        static let animationFadeDelay: TimeInterval = 0.6
        static let focusDuration: TimeInterval = 1.0  // 总动画时长
    }
    
    // MARK: - Photo Library
    enum PhotoLibrary {
        static let thumbnailSize = CGSize(width: 200, height: 200)
        static let thumbnailLoadingAlpha: CGFloat = 0.7
        static let thumbnailFinalAlpha: CGFloat = 1.0
        static let thumbnailFadeDuration: TimeInterval = 0.15
    }
}

